<%@ page language = "java"%>
<%@ page import = "com.scalar.chiptrack.utils.ConfigManager"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<HEAD>
	<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
	<TITLE>Scalarsoft - ChipTrac</TITLE>
	<LINK href='<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css' type="text/css" rel='stylesheet'>

<!-- Validations starts here -->
<SCRIPT language = "javascript" src = "<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</SCRIPT>
<SCRIPT language="javascript">
 function deleteInvoice()
 {
    document.salesOrderInvoiceForm.action='<%=chipTracContext%>/salesOrderInvoice.do?action=delete';
    document.salesOrderInvoiceForm.submit();
 }


</SCRIPT>
<!-- Validations ends here -->
<% int i = 0; /*variable used to assign Serial numers */ %>
</HEAD>
<BODY bgColor="#ffffff" topMargin='0' leftMargin='0' marginHeight='0' marginWidth='0'>

<!-- Top header start here -->
	<%@ include file = "/jsp/includes/header.jsp"%>
<!-- Top header ends here -->

<P>
<TABLE BORDER="0" width="100%" cellSpacing=0 cellPadding=0>
<TR>
<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
<!-- Side Navigation Starts Here  -->
	<%@ include file="/jsp/sales/sales_menu.jsp"%>
<!-- Side Navigation Ends Here -->
</TD>
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<!-- SiteMap Tag -->
<!-- chiptrack:sitemap styleClass="NArialS"/ -->

<chiptrack:permission functionality='<%=Functionality.SALES_ORDER_INVOICE%>'
    action='<%=User.USER_ACTION_MODIFY%>' styleClass="NArialL" >
</chiptrack:permission>

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<!-- from here your body starts -->
<P>
<html:form name="salesOrderInvoiceForm" action="/salesOrderInvoice.do?action=search" method="post" type="com.scalar.chiptrack.sales.forms.SalesOrderInvoiceForm">
    <TABLE BORDER="0" WIDTH="100%">

      <TR>
        <TD WIDTH="100%">
        <TABLE BORDER="0" WIDTH="100%">
            <TR>
              <TD WIDTH="100%" class="NArialW">
                <P ALIGN="CENTER"> Sales Invoice Details
              </TD>
            </TR>
            <TR>
              <TD WIDTH="100%">&nbsp;</TD>
            </TR>
            <TR>
              <TD><chiptrack:info styleClass="NArialL" /></TD>
            </TR>
            <TR>
              <TD><chiptrack:errors styleClass="NArialL" /></TD>
            </TR>
            <TR>
              <TD><chiptrack:moreErrorInfo styleClass="NArialL" /></TD>
            </TR>
            <TR>
              <TD colspan='5' align="left" class='NArialL'><FONT id="errors" styleClass="NArialL" color='FF0000'></FONT>
              </TD>
            </TR>
    </TABLE>
    </TD>
  </TR>

  <% String value = (String)request.getAttribute("setConfirm");

    if( "Yes".equalsIgnoreCase(value) == true) {
    %>
    <script language="javascript">

    var pa = document.getElementById("errors");
    var htmltext1  = "<li> Are you sure, you want to delete this Invoice Details ? ";
    htmltext1 = htmltext1+'<a href="javascript:deleteInvoice();"><img src="<%=chipTracContext%>/jsp/includes/images/confirm.gif" border="0" onMouseOver="window.status=\'Click to Confirm Remove Customer\';return true" onmouseout="window.status=\'\';return true" title="Click here to Confirm Remove Invoice"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
    pa.insertAdjacentHTML('BeforeEnd',htmltext1);

    </script>
  <% }%>

  <TR>
    <TD WIDTH="100%">
    <nested:nest property="salesOrderInvoice">
    <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
	    <TR>
		  <TD WIDTH="7%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Document No:</TD>
		  <TD WIDTH="4%">&nbsp;</TD>
		  <TD WIDTH="16%" nowrap>
            <nested:write property="invoiceNumber" />
		  </TD>
		  <TD WIDTH="8%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Document Type:</TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		  <TD WIDTH="18%" nowrap>
            <nested:write property="invoiceDocumentTypeIdLabel" />&nbsp;&nbsp;&nbsp;&nbsp;<nested:checkbox property="hold" styleClass="txfield" disabled="true"/> Hold
          </TD>
		  <TD WIDTH="13%">&nbsp;</TD>
		</TR>
		<TR>
		  <TD WIDTH="7%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Customer Name:</TD>
		  <TD WIDTH="3%">&nbsp;</TD>
		  <TD WIDTH="16%" nowrap>
            <nested:write property="customerName" />
		  </TD>
		  <TD WIDTH="8%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Customer PO No:</TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		  <TD WIDTH="18%" nowrap>
            <nested:write property="customerPONumber" />&nbsp;
          </TD>
		  <TD WIDTH="13%">&nbsp;</TD>
		</TR>
		<TR>
		  <TD WIDTH="7%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Quote No:</TD>
		  <TD WIDTH="4%">&nbsp;</TD>
		  <TD WIDTH="16%" nowrap>
            <nested:write property="quoteNumber" />&nbsp;
          </TD>
		  <TD WIDTH="8%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Default Site:</TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		  <TD WIDTH="18%" nowrap>
		    <nested:write property="locationCode" />
		  </TD>
		  <TD WIDTH="13%">&nbsp;</TD>
		</TR>
		<TR>
		  <TD WIDTH="7%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Date:</TD>
		  <TD WIDTH="4%">&nbsp;</TD>
		  <TD WIDTH="16%" nowrap>
            <nested:write property="documentDate" />
          </TD>
		  <TD WIDTH="8%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Quote Date:</TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		  <TD WIDTH="18%" nowrap>
            <nested:write property="quotedDate" />&nbsp;
          </TD>
		  <TD WIDTH="13%">&nbsp;</TD>
		</TR>
		<TR>
		  <TD WIDTH="7%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Posting Date:</TD>
		  <TD WIDTH="4%">&nbsp;</TD>
		  <TD WIDTH="16%" nowrap>
            <nested:write property="postingDate" />&nbsp;
          </TD>
		  <TD WIDTH="8%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Order Date:</TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		  <TD WIDTH="18%" nowrap>
            <nested:write property="orderDate" />&nbsp;
          </TD>
		  <TD WIDTH="13%">&nbsp;</TD>
		</TR>
		<TR>
        <TR>
		  <TD WIDTH="7%">&nbsp;</TD>
		  <TD WIDTH="14%" nowrap>Sales Order No:</TD>
		  <TD WIDTH="4%">&nbsp;</TD>
		  <TD WIDTH="16%" nowrap>
            <nested:write property="salesOrderNumber" />&nbsp;
          </TD>
		  <TD WIDTH="55%" colspan = "5">&nbsp;</TD>
		</TR>
		<TR>
		  <TD WIDTH="100%" colspan = "9">&nbsp;</TD>
		</TR>
	  </TABLE>
    <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
	    <TR BGCOLOR="#990000">
		  <TD WIDTH="4%">
		    <P ALIGN="CENTER"><B><FONT COLOR="white">S.No</FONT></B>
		  </TD>
		  <TD WIDTH="20%">
		    <P ALIGN="CENTER"><B><FONT COLOR="white">Sales Order Number</FONT></B>
		  </TD>
          <TD WIDTH="20%">
		    <P ALIGN="CENTER"><B><FONT COLOR="white">Mktg.Part Number</FONT></B>
		  </TD>
		  <TD WIDTH="10%">
		    <P ALIGN="CENTER"><B><FONT COLOR="white">Quantity</FONT></B>
		  </TD>
		  <TD WIDTH="9%" nowrap>
		    <P ALIGN="CENTER"><B><FONT COLOR="white">Unit Price($)</FONT></B>
		  </TD>
		  <TD WIDTH="28%">
		    <P ALIGN="CENTER"><B><FONT COLOR="white">Description</FONT></B>
		  </TD>
		  <TD WIDTH="8%" nowrap>
		    <P ALIGN="CENTER"><B><FONT COLOR="white">Unit Cost($)</FONT></B>
		  </TD>
		  <TD WIDTH="9%" nowrap>
		    <P ALIGN="CENTER"><B><FONT COLOR="white">MarkDown($)</FONT></B>
		  </TD>
		  <TD WIDTH="10%" nowrap>
		    <P ALIGN="CENTER"><B><FONT COLOR="white">Extended Price($)</FONT></B>
		  </TD>
		  <TD WIDTH="2%" BGCOLOR="white">&nbsp;</TD>
		</TR>
        <nested:iterate property="salesOrderInvoiceLineItemList" type="com.scalar.chiptrack.sales.SalesOrderInvoiceLineItem" >
		<TR>
          <TD WIDTH="4%" BGCOLOR="#DEE1E2">
		    <P ALIGN="CENTER"><nested:write property="invoiceIndex" />
		  </TD>
          <TD WIDTH="20%" BGCOLOR="#DEE1E2" ALIGN="LEFT">
            <nested:write property="salesOrderNumber"/>
		  </TD>
          <TD WIDTH="20%" BGCOLOR="#DEE1E2" ALIGN="LEFT">
			   &nbsp;<nested:write property="marketingPartNo" />
		  </TD>
          <TD WIDTH="10%" BGCOLOR="#DEE1E2" ALIGN="RIGHT">
		    <P><nested:write property="quantity" />
		  </TD>
		  <TD WIDTH="9%" BGCOLOR="#DEE1E2" ALIGN="RIGHT">
		    <P><nested:write property="unitPrice" />
		  </TD>
		  <TD WIDTH="28%" BGCOLOR="#DEE1E2" ALIGN="LEFT">
		    <P>&nbsp;<nested:write property="lineItemDescription" />
		  </TD>
		  <TD WIDTH="8%" BGCOLOR="#DEE1E2" ALIGN="RIGHT">
		    <P><nested:write property="unitCost" />
		  </TD>
		  <TD WIDTH="9%" BGCOLOR="#DEE1E2" ALIGN="RIGHT">
		    <P><nested:write property="markDown" />
		  </TD>
		  <TD WIDTH="10%" BGCOLOR="#DEE1E2" ALIGN="RIGHT">
		    <P><nested:write property="extendedPrice" />
		  </TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		</TR>
       <% i++;%>
       </nested:iterate>
       </TABLE>
        <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
               	  <TR>
		  <TD WIDTH="4%">&nbsp;</TD>
		  <TD WIDTH="15%">&nbsp;</TD>
		  <TD WIDTH="11%">&nbsp;</TD>
		  <TD WIDTH="8%">&nbsp;</TD>
		  <TD WIDTH="31%">&nbsp;</TD>
		  <TD WIDTH="17%">
            Sub Total:
		  </TD>
		  <TD WIDTH="13%" ALIGN="RIGHT" bgcolor="#DEE1E2">
            <P><nested:hidden property="subTotal" />
		    <nested:write property="subTotalAsString" />
		  </TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		</TR>
		<TR>
          <TD WIDTH="19%" colspan="2">
            Amount Received:
		  </TD>
          <TD WIDTH="40%" colspan="3">
		    <p><nested:hidden property="amountReceived" />
			    &nbsp;&nbsp;&nbsp;<nested:write property="amountReceivedAsString" />
		  </TD>
		  <!--TD WIDTH="3%">&nbsp;</TD-->
		  <TD WIDTH="17%">
            Trade Discount:
		  </TD>
		  <TD WIDTH="12%" ALIGN="RIGHT" bgcolor="#DEE1E2">
		    <P><nested:hidden property="tradeDiscount" />
			    <nested:write property="tradeDiscountAsString" />
		  </TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		</TR>
        <TR>
          <TD WIDTH="19%" colspan="2" >
            <nested:equal property="invoiceDocumentTypeId" value="1" >
                Terms&nbsp;Discount&nbsp;Taken:
            </nested:equal>
            <nested:notEqual property="invoiceDocumentTypeId" value="1" >
                Discount&nbsp;Returned:
            </nested:notEqual>
		  </TD>
          <TD WIDTH="40%" colspan="3">
            <p>&nbsp;&nbsp;<nested:hidden property="discountTaken" />
			    <nested:write property="discountTakenAsString" />
		  </TD>
		  <TD WIDTH="17%">
            Freight:
		  </TD>
		  <TD WIDTH="12%" ALIGN="RIGHT" bgcolor="#DEE1E2">
		    <P><nested:hidden property="freight" />
			    <nested:write property="freightAsString" />
		  </TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		</TR>
        <TR>
          <TD WIDTH="19%" colspan="2" >
            On Account:
		  </TD>
          <TD WIDTH="40%" colspan="3">
            <p>&nbsp;&nbsp;<nested:hidden property="accountAmount" />
			    <nested:write property="accountAmountAsString" />
		  </TD>
		  <!--TD WIDTH="8%">&nbsp;</TD-->
		  <TD WIDTH="17%">
            Miscellaneous:
		  </TD>
		  <TD WIDTH="12%" ALIGN="RIGHT" bgcolor="#DEE1E2">
		    <P><nested:hidden property="miscellaneous" />
			    <nested:write property="miscellaneousAsString" />
		  </TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		</TR>
        <TR>
          <TR>
          <TD WIDTH="19%" colspan="2" >
           Comment:
		  </TD>
          <TD WIDTH="39%" colspan="2" >&nbsp;</TD>
		  <TD WIDTH="8%">&nbsp;</TD>
		  <TD WIDTH="17%">
            Tax:
		  </TD>
		  <TD WIDTH="12%" ALIGN="RIGHT" bgcolor="#DEE1E2">
		    <nested:hidden property="tax" />
            <p><nested:write property="taxAsString" />
		  </TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		</TR>
        <TR>
         <TD WIDTH="58%" colspan="5" rowspan="3">
             <nested:textarea property="commentDescription" rows="4" cols="60" disabled="true" readonly="true"/>
            <nested:hidden property="commentId"/>
		  </TD>
		  <TD WIDTH="17%">
            Total:
		  </TD>
		  <TD WIDTH="12%" ALIGN="RIGHT" bgcolor="#DEE1E2">
            <P><nested:hidden property="total" />
			<nested:write property="totalAsString" />
		  </TD>
		  <TD WIDTH="2%">&nbsp;</TD>
		</TR>
        <TR>
          <TD WIDTH="100%" colspan="9" >&nbsp;</TD>
		</TR>
	    </TABLE>
	</TD>
  </TR>
	<TR>
	    <TD WIDTH="100%">&nbsp;
			<TABLE BORDER="0" WIDTH="100%">
	            <TR>
					<TD WIDTH="36%">&nbsp;</TD>
					<TD WIDTH="25%">&nbsp;</TD>
					<TD WIDTH="39%">&nbsp;</TD>
				</TR>
				<TR>
				    <TD WIDTH="36%">&nbsp;</TD>
					<TD WIDTH="25%">
						<P ALIGN="CENTER"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/save.gif" WIDTH="53" HEIGHT="17" ALIGN="BOTTOM" BORDER="0">&nbsp;<A href="salesOrderInvoice.do" onmouseover="window.status='Click here to go back Sales Order Invoice Search';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/cancel.gif" WIDTH="53" HEIGHT="17" ALIGN="BOTTOM" BORDER="0"></a>&nbsp;<IMG SRC="<%=chipTracContext%>/jsp/includes/images/reset.gif" WIDTH="53" HEIGHT="17" ALIGN="BOTTOM" BORDER="0"></TD>
					<TD WIDTH="39%">&nbsp;</TD>
				</TR>
            </nested:nest>
            </html:form>
			</TABLE>
		</TD>
	</TR>
</TABLE>
</TD>
</TR>

<%@ include file = "/jsp/includes/footer.jsp"%>
</TABLE>
</BODY>

</html>